package com.qianxun.Test.webServiceTest;

import java.net.URL;
import java.util.Scanner;

public class testPhone {
    public static void main(String[] args) throws Exception {
        String regex ="^1[3|4|5|7|8][0-9]\\d{4,8}$";
        System.out.println("请输入你要查询的手机号码");
        while (true){
            Scanner sc = new Scanner(System.in);
            String mobileCode = sc.nextLine();
            if (mobileCode.matches(regex)){
                testPhone.get(mobileCode,"");
                break;
            }else {
                System.out.println("你输入的手机号码有误请重新输入");
            }
        }
    }

    public static void get(String mobileCode ,String userID ) throws Exception{
        URL url=new URL("http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo?mobileCode="+mobileCode+
                "&userID="+userID);
        String boas = testWeather.cq(url);
        String strin=boas.replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n","").replace("<string xmlns=\"http://WebXml.com.cn/\">","").replaceFirst("</string>","");
            System.out.println(strin);
        }
    }
